package com.ybf.api.entity;

import com.github.pagehelper.PageInfo;
import lombok.Data;

import java.util.List;

@Data
public class PageResult<T> {
    private List<T> list;
    private long total;
    private long pageNum;
    private long pageSize;
    private long size;
    private long pages;

    public PageResult(List<T> list) {
        PageInfo<T> pageInfo = new PageInfo<T>(list);
        this.list = pageInfo.getList();
        this.total = pageInfo.getTotal();
        this.pageNum = pageInfo.getPageNum();
        this.pageSize = pageInfo.getPageSize();
        this.size = pageInfo.getSize();
        this.pages = pageInfo.getPages();
    }
}
